package core;

import java.util.StringTokenizer;

public class ProblemType {

    public String[] variableNames, variables, units;

    /**
     * Each parameter is a string delimited by spaces.
     *
     * @param i             The number of elements
     * @param variableNames Formatted variables in HTML
     * @param variables     The variable names
     * @param units         The units
     */
    public ProblemType(int i, String variableNames, String variables, String units) {

        this.variableNames = new String[i];
        this.variables = new String[i];
        this.units = new String[i];

        tokenize(this.variableNames, variableNames);
        tokenize(this.variables, variables);
        tokenize(this.units, units);
    }

    private void tokenize(String[] array, String variableNames) {
        StringTokenizer st = new StringTokenizer(variableNames, " ");

        for (int i = 0; i < array.length; i++)
            array[i] = st.nextToken();

    }
}
